﻿Imports System.Data.SqlClient
Imports Crystal.Common.Model
Imports Crystal.CLL

Public Class cProjectManagement
    Public Shared strConfiguration As String = CommonCLL.mstrConnectionstring

    Public Enum ProjectMenu
        ClientName = 1
        Listing = 2
        Ratio = 3
        ISIO = 4
        SEDOL = 5
        CUSIP = 6
        SDD = 7
        FDRD = 8
        ProjectStatus = 9
        CompletedDate = 10
        Ignored = 11
        ShareinIssue = 12
        ShareOutstanding = 13
        FreeFloat = 14
        Country = 15
        Region = 16
        ReportHistory = 17
        DDForm = 18
        DTCList = 19
        ShareRegister = 20
        OfferingList = 21
    End Enum

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="intSearchin"></param>
    ''' <param name="strLookFor"></param>
    ''' <param name="Criteria"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared Function SearchProjects(ByVal intSearchin As Integer, ByVal strLookFor As String, ByVal Criteria As Short) As IDataReader

        Dim eReturnVal As ExecutionResult = Nothing
        Dim param(2) As SqlParameter
        param(0) = New SqlParameter("@SearchIn", intSearchin)
        param(1) = New SqlParameter("@LookFor", strLookFor)
        param(2) = New SqlParameter("@SearchCriteria", Criteria)
        eReturnVal = CoreFunctions.Execute(strConfiguration, "CR_sp_PRJ_SearchProjects", CommandType.StoredProcedure, ReturnTypes.DataReader, param)
        Return CType(eReturnVal.ResultObject, IDataReader)
    End Function

    ''' <summary>
    ''' 
    ''' </summary>
    ''' <param name="projectID"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared Function GetParticularProject(ByVal projectID As Integer) As DataSet
        Dim eReturnVal As ExecutionResult = Nothing
        Dim param(0) As SqlParameter
        param(0) = New SqlParameter("@ProjectID ", projectID)
        eReturnVal = CoreFunctions.Execute(strConfiguration, "CR_sp_PRJ_GetParticularProject", CommandType.StoredProcedure, ReturnTypes.DataSet, param)
        Return CType(eReturnVal.ResultObject, DataSet)
    End Function
    Public Shared Function DeleteUpdateProjectStatus(ByVal projectID As Integer) As String
        Dim eReturnVal As ExecutionResult = Nothing
        Dim result As String = String.Empty
        Dim param(0) As SqlParameter
        param(0) = New SqlParameter("@ProjectID ", projectID)
        eReturnVal = CoreFunctions.Execute(strConfiguration, "CR_sp_PRJ_DeleteOrUpdateStatus", CommandType.StoredProcedure, ReturnTypes.Scalar, param)
        Return CType(eReturnVal.ResultObject, String)
    End Function

End Class
